package com.zc.datastructure.structure.graph;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author: zhuCan
 * @date: 2020/6/27 10:57
 * @description:
 */
@Slf4j
public class Test {

  public static void main(String[] args) {
    Graph<String> graph = new ImmutableGraph<>();

    GraphDecorator<String> decorator = new GraphDecorator<>(graph);

    ArrayList<String> vertex = new ArrayList<>();
    vertex.add("A");
    vertex.add("B");
    vertex.add("C");
    vertex.add("D");
    vertex.add("E");
    vertex.add("F");
    vertex.add("G");
    vertex.add("H");

    decorator.create(vertex);


    decorator.addEdge(new Edge<>("A", "B", "AB"));
    decorator.addEdge(new Edge<>("A", "D", "AD"));
    decorator.addEdge(new Edge<>("A", "G", "AG"));
    decorator.addEdge(new Edge<>("C", "B", "CB"));
    decorator.addEdge(new Edge<>("B", "A", "BA"));
    decorator.addEdge(new Edge<>("F", "E", "FE"));
    decorator.addEdge(new Edge<>("B", "D", "BD"));
    decorator.addEdge(new Edge<>("G", "B", "GB"));
    decorator.addEdge(new Edge<>("A", "B", "AB"));
    decorator.addEdge(new Edge<>("H", "B", "HB"));
    decorator.addEdge(new Edge<>("E", "A", "EA"));
    decorator.addEdge(new Edge<>("E", "B", "EB"));
    decorator.addEdge(new Edge<>("C", "G", "CG"));
    decorator.addEdge(new Edge<>("B", "H", "BH"));
    decorator.addEdge(new Edge<>("G", "D", "GD"));



    List<String> dfs = decorator.DFS("A", new ArrayList<>());
    dfs.forEach(log::info);
  }
}
